package com.ruoyi.project.ums.service;

import java.time.LocalDateTime;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.db.ums.mapper.UmsAddressMapper;
import com.ruoyi.db.ums.domain.UmsAddress;
import com.ruoyi.db.ums.domain.query.UmsAddressQueryVo;

/**
 * 收货地址Service业务层处理
 *
 * @author ruoyi
 * @date 2020-04-22
 */
@Service
public class UmsAddressService
{
    @Autowired
    private UmsAddressMapper umsAddressMapper;

    /**
     * 查询收货地址
     *
     * @param id 收货地址ID
     * @return 收货地址
     */
    public UmsAddress selectUmsAddressById(Long id)
    {
        return umsAddressMapper.selectUmsAddressById(id);
    }

    /**
     * 查询收货地址列表
     *
     * @param umsAddress 收货地址
     * @return 收货地址
     */
    public List<UmsAddress> selectUmsAddressList(UmsAddressQueryVo umsAddressQueryVo)
    {
        return umsAddressMapper.selectUmsAddressList(umsAddressQueryVo);
    }

    /**
     * 新增收货地址
     *
     * @param umsAddress 收货地址
     * @return 结果
     */
    public int insertUmsAddress(UmsAddress umsAddress)
    {
        return umsAddressMapper.insertUmsAddress(umsAddress);
    }

    /**
     * 修改收货地址
     *
     * @param umsAddress 收货地址
     * @return 结果
     */
    public int updateUmsAddress(UmsAddress umsAddress)
    {
        umsAddress.setUpdateTime(LocalDateTime.now());
        return umsAddressMapper.updateUmsAddress(umsAddress);
    }

    /**
     * 批量删除收货地址
     *
     * @param ids 需要删除的收货地址ID
     * @return 结果
     */
    public int deleteUmsAddressByIds(Long[] ids)
    {
        return umsAddressMapper.deleteUmsAddressByIds(ids);
    }

    /**
     * 删除收货地址信息
     *
     * @param id 收货地址ID
     * @return 结果
     */
    public int deleteUmsAddressById(Long id)
    {
        return umsAddressMapper.deleteUmsAddressById(id);
    }
}
